package com.obixlabs.security.credentialsstore.model;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;


public class ObixGroups extends HashMap<String, ObixGroup>
{
	private static final long serialVersionUID = -1729694793391900434L;

	public void add(ObixGroup group)	
	{put(group.getName(), group);}

	public Collection<ObixGroup> difference(Collection<ObixGroup> groups)
	{
		Map<String, ObixGroup> copy = new HashMap<String, ObixGroup>();
		copy.putAll(this);
		
		for (ObixGroup obixGroup : groups)
		{
			if (copy.containsKey(obixGroup.getName()))
				copy.remove(obixGroup.getName());
		}
		
		return copy.values();
	}
}
